package com.ruoyi.community.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.CommunityRepairMapper;
import com.ruoyi.community.domain.CommunityRepair;
import com.ruoyi.community.service.ICommunityRepairService;

/**
 * 维修管理Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-18
 */
@Service
public class CommunityRepairServiceImpl implements ICommunityRepairService
{
    @Autowired
    private CommunityRepairMapper communityRepairMapper;

    /**
     * 查询维修管理
     *
     * @param id 维修管理主键
     * @return 维修管理
     */
    @Override
    public CommunityRepair selectCommunityRepairById(Long id)
    {
        return communityRepairMapper.selectCommunityRepairById(id);
    }

    /**
     * 查询维修管理列表
     *
     * @param communityRepair 维修管理
     * @return 维修管理
     */
    @Override
    public List<CommunityRepair> selectCommunityRepairList(CommunityRepair communityRepair)
    {
        return communityRepairMapper.selectCommunityRepairList(communityRepair);
    }

    /**
     * 新增维修管理
     *
     * @param communityRepair 维修管理
     * @return 结果
     */
    @Override
    public int insertCommunityRepair(CommunityRepair communityRepair)
    {
        return communityRepairMapper.insertCommunityRepair(communityRepair);
    }

    /**
     * 修改维修管理
     *
     * @param communityRepair 维修管理
     * @return 结果
     */
    @Override
    public int updateCommunityRepair(CommunityRepair communityRepair)
    {
        if ("".equals(communityRepair.getPerson()) || communityRepair.getPerson() == null){
            communityRepair.setPerson("张三");
        }
        return communityRepairMapper.updateCommunityRepair(communityRepair);
    }

    /**
     * 批量删除维修管理
     *
     * @param ids 需要删除的维修管理主键
     * @return 结果
     */
    @Override
    public int deleteCommunityRepairByIds(Long[] ids)
    {
        return communityRepairMapper.deleteCommunityRepairByIds(ids);
    }

    /**
     * 删除维修管理信息
     *
     * @param id 维修管理主键
     * @return 结果
     */
    @Override
    public int deleteCommunityRepairById(Long id)
    {
        return communityRepairMapper.deleteCommunityRepairById(id);
    }
}
